#!/usr/bin/perl

  use Mail::POP3Client;

  $pop = new Mail::POP3Client( USER     => "username",
                               PASSWORD => "password",
                               HOST     => "pop.server.com" );

  $a = $pop->Count();             # Number of messages
  print $a;

  for ($i = 1; $i <= $pop->Count(); $i++) {
    foreach ( $pop->Head( $i ) ) {            # Print the header
       print "$_\n";
    }
    foreach ( $pop->Body( $i ) ) {            # Print the body
       print "$_\n";
    }
    print "\n";
  }

$pop->close();                                # close the connection
